Switch Vs If-else
1832
22-Jun-2018
Prakash nidhi Verma
22-Jun-2018switch vs if else :
In switch every condition is given very clear and they execute directly from condition but if else check all condition line by line they don't reach directly on conditions. some points given below for differentiate them :
1- Switch better for Multi way branching than if else
2- if-else better for boolean values than switch.
3- Speed is better for switch than if-else.
4- Clarity in readability is better in switch.
5- Check Testing Expression is good in switch.